<script language="javascript">
	function showtheoloai(d)
	{
		document.ds.anloaitin.value=d.value;
		//alert(document.ds.anloaitin.value);
		showdataday('id_loaitin','admin/showloaitintuc.php?loai=' + d.value);
	}
</script>
<form name="ds" action="home_admin.php" method="post">
	<p>DANH SÁCH LOẠI TIN TỨC</p>
		<div>
		  <label class="stylelitle"><input type="radio" name="loaitin" value="1" onclick="showtheoloai(this)" />&nbsp;Xã hội&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		  <input type="radio" checked="checked" onclick="showtheoloai(this)" name="loaitin" value="0" />
		  &nbsp;Nội bộ</label>
			<br /><input type="hidden" name="anloaitin" value="0" />
			<div id="id_loaitin" align="center">
				<?php
					//$loai=0;
					$kq=$knoi->queryCsdl("select * from loaitintuc where loai=0");
					if(mysql_num_rows($kq)<1)
					{
						echo "<br><label class='stylelitle'>Hiện tại chưa có loại tin nội bộ nào!</label>";
					}
					else
					{
				?>
				<table align="center" style="border:solid #FFFFFF; background-color:#F5F5F5">
						<tr class="stylelitle"  style="text-align:center; background-color:#CCFFFF"><td style="text-align:right">Stt&nbsp;</td><td style="text-align:center;">Mã loại</td><td>Tên loại</td><td>Chi tiết</td><td>Xóa</td></tr>
					<?php
						$i=1;
						while($n=mysql_fetch_array($kq))
						{
							if($i%2==0)
						$color='#FFFFCC';
					else
						$color='#FFFFFF';
					?>
						<tr  class="classtr" style="text-align:left; background-color:<?php echo $color; ?>;"><td style="text-align:right"><?php echo $i; ?>&nbsp;</td><td style="text-align:center"><?php echo $n['maloaitt']; ?></td><td>&nbsp;<?php echo $n['tenloai']; ?></td><td style="text-align:center"><a  href="home_admin.php?module=loaitintuc&maloaitt=<?php echo $n['maloaitt']; ?>"><img src="images/chitiet.png" border="0" title="Chi tiết loại tin tức" /></a></td><td style="text-align:center"><a href="home_admin.php?module=xoa&field=maloaitt&table=loaitintuc&value=<?php echo $n['maloaitt']; ?>"><img src="images/Sign-Error-icon1.png" border="0" title="Xóa loại tin tức" /></a></td></tr>
					<?php
						$i++;
						}
					?>
				</table>
				<?php
					}
				?>
			
			<br /><label style="text-align:center" class="button"><a href="home_admin.php?module=loaitintuc&loai=0"><img src="images/add.png" border="0">&nbsp;Loại tin tức mới</a></label>
			</div>
  </div>
</form>
